// 全局状态配置----每次页面跳转前检查当前用户的登陆状态
import { createStore } from "vuex";
const Store = createStore({
    state () {
        return {
            userName: '',
            userPassword: ''
        }
    },
    getters: {
        isLogin: (state) => {
            return state.userName.length > 0
        }
    },
    mutations: {
        clearUserInfo(state) {
            state.userName = '';
            state.userPassword = '';
        },
        registUserInfo(state,{name,password}){
            state.userName = name;
            state.userPassword = password;
        }
    }
})

export default Store;